package com.api.shopapi.service.impl;

import com.api.shopapi.entity.OrderRefundApply;
import com.api.shopapi.mapper.OrderRefundApplyMapper;
import com.api.shopapi.service.OrderRefundApplyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("OrderRefundApplyServiceImplOne")
public class OrderRefundApplyServiceImpl implements OrderRefundApplyService {

    @Autowired
    private OrderRefundApplyMapper orderRefundApplyMapper;

    @Override
    public int insert(OrderRefundApply orderRefundApply) {
        return orderRefundApplyMapper.insert(orderRefundApply);
    }

    @Override
    public int update(OrderRefundApply orderRefundApply) {
        return orderRefundApplyMapper.update(orderRefundApply);
    }

    @Override
    public int delete(String orderRefundApplyCode) {
        return orderRefundApplyMapper.delete(orderRefundApplyCode);
    }

    @Override
    public OrderRefundApply getByOrderRefundApplyCode(String orderRefundApplyCode) {
        return orderRefundApplyMapper.getByOrderRefundApplyCode(orderRefundApplyCode);
    }

    @Override
    public PageInfo<OrderRefundApply> getPageList(int pageIndex, int pageSize, String userCode, String businessCode) {
        PageHelper.startPage(pageIndex,pageSize);
        List<OrderRefundApply> orderRefundApplyList = orderRefundApplyMapper.getPageList(userCode, businessCode);
        PageInfo<OrderRefundApply> orderRefundApplyPageInfo=new PageInfo<>(orderRefundApplyList);
        return orderRefundApplyPageInfo;
    }
}
